package cn.tedu.cat;


import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

//Component是组件的意思
// 一个类一旦添加@Component注解
// 表示当前类会自动实例化对象到Spring容器中
@Component("cc")
@Lazy
//@Scope("prototype")
public class Cat {

    private String name="小花";
    private String color="三花";
    private Integer age=4;

    // 定义一个无参构造方法,输出运行信息
    public Cat(){
        System.out.println("Cat类实例化完成!");
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Cat{" +
                "name='" + name + '\'' +
                ", color='" + color + '\'' +
                ", age=" + age +
                '}';
    }
}
